TARGET := vlog-cut

OBJECT := out/main.o \
          out/cutting.o \
          out/ringbuffer.o \
          out/demuxer_rtsp.o \
          out/decode_h264.o \
          out/motion_detect.o \
          out/muxer_mp4.o \
          out/raw_save.o \
          out/logger.o \
          out/utils.o \

IFLAGS := -Iinc \
          -I/usr/include/opencv4

LFLAGS := -lavformat \
          -lavcodec \
          -lavutil \
          -lswscale \
          -lspdlog \
          `pkg-config --libs opencv4`

CFLAGS := -std=c++17

out/%.o: src/%.cpp
	g++ -c -o $@ $^ $(IFLAGS) $(CFLAGS)

$(TARGET): $(OBJECT)
	g++ -o $@ $^ $(IFLAGS) $(LFLAGS) $(CFLAGS)

clean:
	rm -rf $(TARGET)
	rm -rf $(OBJECT)